package com.listeningframework.boot.autoconfigure.webmvc.validate;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

/**
 * Validate Annotation For String ListeningDecimalPattern
 * @author lixining
 * @version $Id: ListeningDecimalPattern.java, v 0.1 2016年5月5日 下午4:13:22 lixining Exp $
 */
@Constraint(validatedBy = ListeningDecimalPatternValidator.class)
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ListeningDecimalPattern {
    /**
     * 整数部分长度
     *
     * @return int
     */
    int presion();

    /**
     * 小数部分长度
     *
     * @return int
     */
    int scale();

    /**
     * 默认是否允许空
     *
     * @return boolean
     */
    boolean allowBlank() default false;

    /**
     * message、groups、payload must be defined when define custom validation annotation
     *
     * @return String
     */
    String message() default "{listening.invalid.decimal}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
